<script>
export default {
  name: "Logout",
  methods: {
    logout() {
      this.$store.dispatch('logoutUser');
    }
  },
  computed: {
    username() {
      return this.$store.state.username;
    }
  }
}
</script>

<template>
  <div class="logout">
    <img src="@/assets/user-head.svg" alt="username-img" />
    <span class="logout-username">{{ username }}</span>
    <el-button class="logout-button" type="danger" @click=logout>注销</el-button>
  </div>
</template>

<style scoped>
  .logout {
    display: flex;
    align-items: center;
    height: 100%;
    width: 100%;
  }

  .logout-button {
    margin-right: 20px;
    color: white;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
  }

  .logout img {
    height: 60%;
  }

  .logout-el-button :hover {
  }

  .logout-username {
    margin: 0 10px;
    font-size: 18px;
    color: #fff;
    font-weight: bold;
    font-family: Arial, sans-serif; /* 指定 Arial 和 sans-serif 字体族 */
  }
</style>